package pub.cleangao.mqtt;


import lombok.Data;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import pub.cleangao.common.event.DefaultReactEvent;
import pub.cleangao.common.event.EventBus;


@Component
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@Data
public class MqttServer {

    //MQTT服务器的IP地址
    private String host;

    //MQTT服务器的端口号
    private int port;

    //连接MQTT服务器的clientId
    private String clientId;

    // 连接MQTT服务器的用户名
    private String username;

    // 连接MQTT服务器的密码
    private String password;

    // 当前请求者的公网IP
    private String localAddress;


    public void reconnect() {
        EventBus.publish(DefaultReactEvent.sudden("mqtt:server-reconnect"));
    }
}
